using System;
using Volo.Abp.Domain.Entities;

namespace AuthService.Domain.Security;

/// <summary>
/// 安全事件实体
/// </summary>
public class SecurityEvent : Entity<Guid>
{
  
    /// <summary>
    /// 租户ID
    /// </summary>
    public Guid? TenantId { get; set; }

    /// <summary>
    /// 事件ID
    /// </summary>
    public virtual string EventId { get; set; } = string.Empty;

    /// <summary>
    /// 用户ID
    /// </summary>
    public virtual Guid? UserId { get; set; }

    /// <summary>
    /// 事件类型
    /// </summary>
    public virtual string EventType { get; set; } = string.Empty;

    /// <summary>
    /// 事件描述
    /// </summary>
    public virtual string Description { get; set; } = string.Empty;

    /// <summary>
    /// 风险级别
    /// </summary>
    public virtual string RiskLevel { get; set; } = "Low";

    /// <summary>
    /// 事件时间
    /// </summary>
    public virtual DateTime EventTime { get; set; }

    /// <summary>
    /// IP地址
    /// </summary>
    public virtual string IpAddress { get; set; } = string.Empty;

    /// <summary>
    /// 用户代理
    /// </summary>
    public virtual string UserAgent { get; set; } = string.Empty;

    /// <summary>
    /// 是否成功
    /// </summary>
    public virtual bool Success { get; set; }

    /// <summary>
    /// 是否成功（别名属性，用于兼容）
    /// </summary>
    public virtual bool IsSuccess => Success;

    /// <summary>
    /// 详情
    /// </summary>
    public virtual string Details { get; set; } = string.Empty;

    /// <summary>
    /// 备注
    /// </summary>
    public virtual string Remark { get; set; } = string.Empty;

    /// <summary>
    /// 是否已处理
    /// </summary>
    public virtual bool IsProcessed { get; set; }

    /// <summary>
    /// 处理时间
    /// </summary>
    public virtual DateTime? ProcessedTime { get; set; }

    /// <summary>
    /// 处理人
    /// </summary>
    public virtual string ProcessedBy { get; set; } = string.Empty;

    public SecurityEvent()
    {
        EventTime = DateTime.Now;
        IsProcessed = false;
    }

    public SecurityEvent(string eventType, string description) : this()
    {
        EventType = eventType;
        Description = description;
    }
}